<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>	

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Insert title here</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<script type="text/javascript">
function check()
{
	var pwd=document.getElementById("pwd").value;
	if(pwd.length<6){
		alert("密码长度不能少于6位");
		return false;
	}
	
	var repwd=document.getElementById("repwd").value;
	if(repwd!=pwd){
		alert("两次密码不一至");
		return false;
	}
	
	var age=document.getElementById("age").value;
	if(age==""){
		alert("年龄不能为空");
		return false;
	}
	
	if(isNaN(age)){
		alert("年龄必须是数字");	
		return false;
	}
	
	var phone=document.getElementById("phone").value;
	if(phone==""){
		alert("电话不能为空");
		return false;
	}
	
	return true;
}
</script>
</head>
<body>
	<div class="main">
		<div class="optitle clearfix">
			<div class="title">用户管理&gt;&gt;</div>

		</div>
		<form method="post" action="userEdit" onsubmit="return check();">
			<div class="content">
				<font color="red">${message}</font>
				<table class="box">
					<tr>
						<td class="field">用户名称：</td>
						<td><input type="text" name="username" class="text" value="${u.username}" readonly="readonly"/> <font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td class="field">用户密码：</td>
						<td><input type="password" name="pwd" class="text" id="pwd" /> <font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td class="field">确认密码：</td>
						<td><input type="password" id="repwd" class="text" /> <font
							color="red">*</font>
						</td>
					</tr>

					<tr>
						<td class="field">用户性别：</td>
						<td><select name="sex">
								<option value="女" >女</option>
								<option value="男" <c:if test="${u.sex=='男'}">selected="selected"</c:if>>男</option>
						</select>
						</td>
					</tr>

					<tr>
						<td class="field">用户年龄：</td>
						<td><input type="text" name="age" value="${u.age}" class="text" id="age" /> <font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td class="field">用户电话：</td>
						<td><input type="text" name="phone" value="${u.phone}" class="text" id="phone" /> <font color="red">*</font>
						</td>

					</tr>
					<tr>
						<td class="field">用户地址：</td>
						<td><textarea name="address" id="textarea" value="${u.address}" class="text" cols="45" rows="5"></textarea>
						</td>
					</tr>
					<tr>
						<td class="field">用户权限：</td>
						<td><input type="radio" name="role" id="auth" value="0" <c:if test="${u.role==0}">checked="checked"</c:if> />普通用户 
							<input type="radio" name="role" id="auth" value="1" <c:if test="${u.role==1}">checked="checked"</c:if> />经理</td>
					</tr>
				</table>
			</div>
			<div class="buttons">
				<input type="submit" name="button" id="button" value="数据提交"
					class="input-button" /> <input type="button" name="button"
					id="button" onclick="window.location='userAdmin';" value="返回"
					class="input-button" />
			</div>

		</form>
	</div>
</body>
</html>
